    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.Servlet;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;

    public class test implements Servlet{

        public test() {
            System.out.println("HelloServlet...");
        }

        @Override
        public void destroy() {
            System.out.println("destroy...");
        }

        @Override
        public ServletConfig getServletConfig() {
            System.out.println("getServletConfig...");
            return null;
        }

        @Override
        public String getServletInfo() {
            System.out.println("getServletInfo...");
            return null;
        }

        @Override
        public void init(ServletConfig arg0) throws ServletException {
            System.out.println("init...");
        }

        @Override
        public void service(ServletRequest arg0, ServletResponse response) throws ServletException, IOException {
            System.out.println("service...");


            //      PrintWriter out = response.getWriter();
            //      out.println("6666666.........");

            response.setCharacterEncoding("UTF-8");
            response.setContentType("application/json; charset=utf-8");
           // String jsonStr = "{\"name\":\"fly\",\"type\":\"虫子\"}";
               String jsonStr =
                    "{ \"id\": 68,\"title\": 6, \"userId\": 2,\"beginDate\": \"2018-05-06\",\"endDate\": \"2018-05-06\",\"status\": 1,\"gmtCreate\": 1525609159000,\"gmtUpdate\": null,\"type\": 0,\"testTime\": 6,\"listExaminationTitle\": [{\"id\": 123,\"title\":\"题目\",\"type\": 1, \"sort\": 1, \"gmt_creat\": \"2018-05-07\",\"task_id\": 1, \"listExmination\": [{\"id \": 1,\"option_content\": \"A 是 B 否\",\"question_id\": 123,\"is_other\": 0 }]}" +
                            ",{ \"id\": 123,\"title\": \"测试\",\"type\": 2,\"sort\": 1,\"gmt_creat\": \"2018-05-07\",\"task_id\": 1,\"listExmination\": " +
                            "[{\"id \": 1,\"option_content\": \"A 是 B 否\"," +
                            "\"question_id\": 123,\"is_other\":0 }] }," +
                            "{ \"id\": 123,\"title\": \"测试\",\"type\": 4,\"sort\":1,\"gmt_creat\": \"2018-05-07\"," +
                            "\"task_id\": 1,\"listExmination\": [{\"id \": 1,\"question_id\": 123,\"remark\": " +
                            "\"备注\" }] },{ " +
                            "\"id\":123, " +
                            "\"title\": \"测试\"," +
                    "\"type\":5,\"sort\":" +
                            "1, " +
                            "\"gmt_creat\":" +
                            "\"2018-05-07\", \"task_id\":" +
                            "1, \"listExmination\": " +
                            "[{\"id \": 1," +
                            "\"question_id\": " +
                            "123,\"remark\": " +
                            "\"备注\"" +
                            " }" +
                            "]" +
                            "" +
                            "}]" +
                            "}" ;

            PrintWriter out = null;
            try {
                out = response.getWriter();
                out.write(jsonStr);
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (out != null) {
                    out.close();
                }
            }
        }

    }

